package com.madou.dbtool.mysql.manager;

import com.madou.common.annotation.HideClass;
import com.madou.dbtool.common.enums.DBEnum;
import com.madou.dbtool.relationship.type.DataType;
import com.madou.dbtool.relationship.type.DataTypeFactory;
import com.mysql.cj.MysqlType;

/**
 * 获取数据JAVA类型的包
 * @author miukoo
 */
@HideClass
public class MysqlDataTypeFactory implements DataTypeFactory {

    @Override
    public DataType getByTypeName(String typeName) {
        return new MysqlDataType(MysqlType.getByName(typeName).getClassName());
    }

    @Override
    public DBEnum type() {
        return DBEnum.MYSQL;
    }

    class MysqlDataType implements DataType{

        String name;

        public MysqlDataType(String name){
            this.name = name;
        }

        @Override
        public String getClassName() {
            return name;
        }

    }
}
